#include<bits/stdc++.h>
using namespace std;
long long n,k;
long long a[100005];
long long ans;

signed main() {
	cin>>n>>k;
	for (long long i=1; i<=n; i++) {
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for (long long i=n; i>=1; i--) {
		int w=a[i]-a[1];
		if (w%k==0) {
			ans+=(a[n]-a[i])/k;
		} else {
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	cout<<ans;
	return 0;
}

